package Blog;

import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.CsvFileSource;
import org.openqa.selenium.By;

import static java.lang.Thread.sleep;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class BlogCases extends InitAndEnd{
    /*
    * 输入正确的账号密码，登录成功
    * */
    @Order(1)
    @ParameterizedTest
    @CsvFileSource(resources = "LoginSuccess.csv")
    public void LoginSuccess(String username,String password,String blog_list_url) throws InterruptedException {
    //打开博客界面
    webDriver.get("http://119.91.235.248:8080/blog_login.html");
    sleep(3000);
    //输入账号，密码
    webDriver.findElement(By.cssSelector("#username")).sendKeys(username);
    webDriver.findElement(By.cssSelector("#password")).sendKeys(password);
    //提交
    webDriver.findElement(By.cssSelector("#submit")).click();
    String cur_url=webDriver.getCurrentUrl();
//    Assertions.assertEquals(blog_list_url,cur_url);

    }
}
